<template>
  <div>
    <el-form :model="form" label-width="80px">
      <el-form-item label="用户姓名">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
    </el-form>
    <el-button @click="submit" type="primary">提交</el-button>
    <el-button @click="fetch" type="primary">获取</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form:{
        name:""
      },
    }
  },
  methods: {
    submit() {
      !!this.form.name && this.$http.post("/user",this.form);
    },
    fetch() {
      this.$http.get("/user");
    }
  }
}
</script>

